export default {
    props:{
        value:''
    },
    data: {
        numbers:"1234567890",
        letters:["qwertyuiop","asdfghjkl","zxcvbnm"],
        symbols:["#$%^&*_+<>","-/：；（）—@“”","…～、？！.，。"],
        isUp:false,
        isShowSymbol:false,
        key:''
    },
    onInit(){
        this.key=this.value || '';
    },
    computed:{
        numberKeys(){
            return this.numbers.split('');
        },
        letterKeys(){
            let keys=[];
            this.letters.forEach(t=>{
                if(this.isUp){
                    t=t.toUpperCase();
                }else{
                    t=t.toLowerCase();
                }
                keys.push(t.split(''))
            })
            return keys;
        },
        symbolKeys(){
            let keys=[];
            this.symbols.forEach(t=>{
                keys.push(t.split(''))
            })
            return keys;
        }
    },
    upKey(){
         this.isUp=!this.isUp;
    },
    deleteOne(){
        this.key=this.key.slice(0,this.key.length-1);
        this._changed();
    },
    keyDown(key){
        this.key+=key;
        this._changed();
    },
    closeIt(){
        this.$emit("close")
    },
    _changed(){
        this.$emit('change',this.key)
    },
    showSymbol(){
        this.isShowSymbol=true;
    },
    showLetter(){
        this.isShowSymbol=false;
    }
}
